package com.itheima.entity;

import java.io.Serializable;

/**
 * 类 名: Result
 * 描 述:封装返回结果
 * 作 者: 蔡畅
 * 创 建：2019年11月19日
 */
public class Result implements Serializable {
    private boolean flag;//执行返回结果,true为成功,false为执行失败
    private String message;//返回提示信息,主要用于页面提示信息
    private Object data;//返回数据

    public Result(boolean flag, String message) {
        super();
        this.flag = flag;
        this.message = message;
    }
    public Result(boolean flag, String message, Object data) {
        this.flag = flag;
        this.message = message;
        this.data = data;
    }


    public static Result success(String message){
        return new Result(true,message);
    }

    public static Result success(String message, Object data){
        return new Result(true,message,data);
    }

    public static Result error(String message){
        return new Result(false,message);
    }

    public boolean isFlag() {
        return flag;
    }

    public void setFlag(boolean flag) {
        this.flag = flag;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
